<?php


namespace app\openapi\controller;


use think\Controller;

class Test extends Controller
{
    public function demo()
    {
        $data = [
            'time' => time(),
            'bb' => '1',
            'ab' => '2',
        ];

        ksort($data);

        $data['sign'] = base64_encode(md5(http_build_query($data)));

        $url = 'http://www.frame.com/openapi/testapi/test';

        $post_data = [
            'header' => [
                'Content-type:application/json',
                'Token:A326D4823704DAE4AD3D75796D14547B'
            ],
            'data' => json_encode($data)
        ];
        $res = curl('POST',$url,$post_data);
        dump($res);
    }
}